home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / util / cli / ksc_TotalReset.lha / TotalReset.asm next >
Encoding:
Assembly Source File  |  1998-04-27  |  1009 b   |  49 lines

  1. ; TotalReset v1.1 : Empty chip-ram and flash until user reset
  2. ; by Kyzer/CSG
  3. ; $VER: TotalReset.asm 1.1 (08.04.98)
  4. ;
  5.     incdir    include:
  6.     include    lvo/exec_lib.i
  7.     include    exec/execbase.i
  8.     include    hardware/custom.i
  9. _custom=$dff000
  10. ROMEND=$1000000
  11. SIZEOFFSET=-$14
  12.  
  13.     move.l    4.w,a6
  14.     move.l    MaxLocMem(a6),d7
  15.     lea    go(pc),a5
  16.     jsr    _LVODisable(a6)
  17.     jsr    _LVOSupervisor(a6)
  18.  
  19. go    move.w    #$7fff,d0
  20.     lea    _custom+dmacon,a5
  21.     move.w    d0,(a6)
  22.     move.w    d0,intena-dmacon(a5)
  23.     move.w    d0,intreq-dmacon(a5)
  24.  
  25.     suba.l    a0,a0
  26.     lea    .codestart(pc),a2
  27.  
  28. .codestart
  29.  
  30. .clear    cmp.l    a2,a0
  31.     bne.s    .notus
  32.     adda.w    #.codeend-.codestart,a0
  33. .notus    clr.l    (a0)+
  34.     cmp.l    d7,a0
  35.     blt.s    .clear
  36.  
  37.     ; 'backwards compatibility' reset routine, ie we shouldn't really
  38.     ; rely on it, but we do. Oh dear.
  39.  
  40.     lea    ROMEND,a0        ; end of ROM
  41.     sub.l    SIZEOFFSET(a0),a0    ; (end of ROM)-(ROM size)=ROM start
  42.     move.l    4(a0),a0        ; Get initial PC
  43.     subq.l    #2,a0            ; now points to second RESET
  44.     cnop    0,4
  45.     reset                ;\_ these two instructions must
  46.     jmp    (a0)            ;/  share a longword.
  47.  
  48. .codeend
  49.